<?php if(is_front_page()){

?>
<div style="display:none;"> <?php }
if (is_page('draftpriview')){
	$bookid = isset( $_GET['bookid'] ) ? intval( $_GET['bookid'] ) : 0;
	$book=get_post($bookid);
	$authorid = (int)$book->post_author;
	$kategori = get_the_category($bookid); 

	if (!empty ($kategori[0])){
	$thecat = $kategori[0]->name;
	$thecatid = $kategori[0]->term_id;
	}
	else $thecat="";
	$posttags = get_the_tags($bookid);
    foreach((array)$posttags as $tag) {
        $show_tags .= $tag->name . ',';
    }
	$rel_art .= rtrim($show_tags , ',');

}					 
?>
					<div class="hr3">
                    <span class="glyphicon glyphicon-bookmark"></span>
                      Cover 
                    </div>
                    <hr class="hr2"/>
					<?php 
									
						$thumb_id = 0;
					if (is_page('draftpriview')){
								$thumb_id = get_post_thumbnail_id( $bookid);
							}	
					else {	
								$thumb_id = get_post_thumbnail_id();
						}
								$thumb_url_array = wp_get_attachment_image_src($thumb_id, 'cover-thumbnails', true);
								$thumb_url = $thumb_url_array[0];
								if (empty ($thumb_url)){
								$thumb_url ="";
								}
												?>
                    <img src="<?php echo $thumb_url ?>"  class="img-thumbnail fotoprofil2">
                    <br/>
                    <br/>
                    <div class="list-group-item" style="border-left:none; border-right:none;">
						<table>
                        	<tr>
                            	<td class="kolom1">penulis </td>
                                <td>:</td>
                                <td class="kolom2"><?php 
								if (is_page('draftpriview')){
								echo "<a href='".get_author_posts_url($authorid)."'>";
								echo get_the_author_meta( 'first_name', $authorid ) . " " . get_the_author_meta( 'last_name', $authorid );
								echo "</a>";
								}
								else {
								$authorid = get_the_author_meta('ID');
								echo "<a href='".get_author_posts_url($authorid)."'>";
								echo get_the_author_meta( 'first_name', $authorid ) . " " . get_the_author_meta( 'last_name', $authorid );
								echo "</a>";
								//the_author_posts_link();
								} ?></td>
                            </tr>
                        </table>
                    </div> 
                    <div class="list-group-item" style="border-left:none; border-right:none;">
                        <table>
                        	<tr>
                            	<td class="kolom1">dibuat</td>
                                <td>:</td>
                                <td class="kolom2"> <?php if (is_page('draftpriview')){
								echo get_the_time('l, d F Y', $bookid) . " " .get_the_time('g:i a', $bookid) ;
								}
								else {	the_time("l, d F Y");?>  <?php the_time("g:i a"); }?></td>
                            </tr>
                        </table>
                    </div> 
					<?php if (!is_page('draftpriview')){?>
                    <div class="list-group-item" style="border-left:none; border-right:none;">
                        <table>
                        	<tr>
                            	<td class="kolom1">diubah</td>
                                <td>:</td>
                                <td class="kolom2"><?php	the_modified_time(); // the_modified_time('l, d F Y'); ?>  <?php // the_modified_time("g:i a"); ?></td>
                            </tr>
                        </table>
                    </div> 
						
                    <div class="list-group-item" style="border-left:none; border-right:none;">
                        <table>
                        	<tr>
                            	<td class="kolom1">vote cerita</td>
                                <td>:</td>
                                <td class="kolom2">
								<?php if(function_exists('the_ratings')) { the_ratings(); } ?>
                                	
                                </td>
                            </tr>
                        </table>
                    </div> <?php } ?>		
             					
					<?php 
					
					if (is_user_logged_in() && ($authorid!=get_current_user_id())){?>
                    <div class="list-group-item" style="border-left:none; border-right:none;">
					<?php wpfp_link() ?>
                     <!--   <button type="button" class="btn">Jadikan Koleksi</button> -->
                    </div> <?php } ?>
					<div class="hr3">
					<span class="glyphicon glyphicon-tag"></span>&nbsp;&nbsp;Tag 
				</div>
				<div class="list-group-item" style="border-left:none; border-right:none;">
					<a><?php if (is_page('draftpriview')){ echo $rel_art;}
					else the_tags('', ', ', ''); ?> </a>
				</div> 
				<br/>
				<br/>
				<div class="hr3">
					<span class="glyphicon glyphicon-filter"></span>&nbsp;&nbsp;Kategori 
				</div>
				<div class="list-group-item" style="border-left:none; border-right:none;">
					<?php if (is_page('draftpriview')){
					echo '<a href="'.get_category_link( $thecatid ).'">'.$thecat.'</a>';
					}
					else echo "<a>"; the_category(', '); ?></a>
				</div> 
					<?php 
					if(is_front_page()) { ?>
				</div>
					
<?php }?>				